package com.qf.web.goodsweb;

import com.github.pagehelper.PageInfo;
import com.qf.bean.goodsbean.Goodsgroup;
import com.qf.service.goodsservice.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@Controller
public class GoodsController {
    @Autowired
    private GoodsService goodsService;

    @RequestMapping("/getgoodsgroups")
    public String a(@RequestParam(defaultValue = "") String groupname, @RequestParam(defaultValue = "1") int index){
        PageInfo<Goodsgroup> findgoodsgroups = goodsService.findgoodsgroups(groupname, index, 1);
        List<Goodsgroup> list = findgoodsgroups.getList();
        System.out.println(findgoodsgroups.getPageNum());
        for (Goodsgroup goodsgroup : list) {
            System.out.println(goodsgroup.getGroupname());
        }
        return "index";
    }
}
